"""
面向对象：继承的基础语法
继承，分为单继承和多继承
"""

# 单继承

class Phone:
    # 旧版
    producer = "Apple"
    id = 2022

    def vpn(self):
        print("梯子开启，爬外网")


class Phone2025(Phone):
    # 新版
    def vpn_new(self):
        print("2025新版梯子")


## 创建对象
print("单继承")
phone = Phone2025()
phone.vpn()
phone.vpn_new()


# 多继承(小米手机=手机+NFC读卡器+红外线遥控器)
class NFCReader:
    def read_card(self):
        print("开始读卡")
    def write_card(self):
        print("开始写卡")

class RemoteControl:
    def control(self):
        print("红外线开启")

class MyPhone(Phone, NFCReader, RemoteControl):
    pass  # 确保类的完整性，表示“空”

print("---------------------------------------------------------")
print("多继承")
"""
多继承的继承顺序从左往右，如果有同名的属性或者方法，先继承的优先级高于后继承的
"""
phone = MyPhone()
phone.vpn()
phone.write_card()
phone.control()


